package com.sanchunhui.psc.ui.activity

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.sanchunhui.psc.R
import kotlinx.android.synthetic.main.header.*

/**
 * @Author zyx
 * @Date 2021/5/25-14:28
 * @Dscribe
 */
class InformationActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_information)
        initHeader()
        processIntent()
    }

    private fun initHeader() {

        back.visibility = View.VISIBLE
        headerTitle.visibility = View.VISIBLE

        back.setOnClickListener { finish() }
    }

    private fun processIntent() {
        if (intent.hasExtra("position")) {
            val name = intent.getSerializableExtra("position")
            when(name)  {
                0 -> headerTitle.text = "看一看"
                1 -> headerTitle.text = "听一听"
                2 -> headerTitle.text = "读一读"
                3 -> headerTitle.text = "考一考"
            }
        }
    }
}